/**
 * @author:ruimin
 * @date:2016年10月25日
 * @description:
 */
$(function () {  
	$("#functionNav").attr("href",navAddr);
	//加载日期控件
	$('.dateInput').datetimepicker({
		format: 'yyyy-mm-dd',
        forceParse: 0,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        minView: 2,
        bootcssVer:3
});
  
  //获取征集单号查询条件
  var form_bwly =$("#form_bwly").serializeObject();
  //获取征集单号查询条件
  var form_jzcg =$("#form_jzcg").serializeObject();

  //初始化征集单列表Table
  createTableOrderBy('#listtbl_bwly','antiques/col.getOutOfGaugeCollection_bwly.do','id',listtblColumns,form_bwly);
  //初始化征集藏品列表Table
  createTableOrderBy('#listtbl_jzcg','antiques/col.getOutOfGaugeCollection_jzcg.do','id',listtbl2Columns,form_jzcg);  
  
  //级联下拉框Id
  var doms_sd1 = ["bwly_sd1","bwly_sd2","bwly_sd3","bwly_sd4"];
  var doms_sd2 = ["jzcg_sd1","jzcg_sd2","jzcg_sd3","jzcg_sd4"];
  selectFour(url_nd,doms_sd1);
  selectFour(url_nd,doms_sd2);
  //设置来源类型下拉列表
  ajaxFunc("get",true,'antiques/sysmanage.getIdAndNameInJb.do?tableName=jb_lyfs',"",getSelectOptions,"bwly_lylx");
  ajaxFunc("get",true,'antiques/sysmanage.getIdAndNameInJb.do?tableName=jb_lyfs',"",getSelectOptions,"jzcg_lylx");
  
  //点击征集单查询-查询按钮
  $("#queryBtn_bwly").click(function(){
	  var form_bwly = $("#form_bwly").serializeObject();   
	  $("#listtbl_bwly").bootstrapTable('refresh',{query:form_bwly});
  });
  //点击征集藏品-查询按钮
  $("#queryBtn_jzcg").click(function(){
	  var form_jzcg = $("#form_jzcg").serializeObject(); 
	  $("#listtbl_jzcg").bootstrapTable('refresh',{query:form_jzcg});
  });
})

//征集单表头
var listtblColumns=[{
    checkbox: true
  }, {
	  field: 'zdjh',
	  title: '总登记号',
	  sortable:true    	
  }, {
	  field: 'cpmc',
	  title: '藏品名称',
	  sortable:true    	
  }, {
	  field: 'djbh',
	  title: '单据编号',
	  sortable:true    	
  }, {
	  field: 'bt',
	  title: '单据名称',
	  sortable:true    	
  }, {
	  field: 'tyyy',
	  title: '提用原因',
	  sortable:true    	
  }, {
	  field: 'cksj',
	  title: '出库时间',
	  sortable:true    	
  }, {
    field: 'ckdjr',
    title: '出库点交人',
    sortable:true
  }, {
    field: 'cktqr',
    title: '出库提取人',
    sortable:true
  }, {
    field: 'sqbmmc',
    title: '申请部门',
    sortable:true
  }, {
    field: 'sqrmc',
    title: '申请人',
    sortable:true
  }];

//征集藏品表头
var listtbl2Columns=[{
    checkbox: true
  }, {
	  field: 'zdjh',
	  title: '总登记号',
	  sortable:true    	
  }, {
	  field: 'cpmc',
	  title: '藏品名称',
	  sortable:true    	
  }, {
	  field: 'djbh',
	  title: '单据编号',
	  sortable:true    	
  }, {
	  field: 'bt',
	  title: '单据名称',
	  sortable:true    	
  }, {
	  field: 'tyyy',
	  title: '提用原因',
	  sortable:true    	
  }, {
	  field: 'cksj',
	  title: '出库时间',
	  sortable:true    	
  }, {
    field: 'ckdjr',
    title: '出库点交人',
    sortable:true
  }, {
    field: 'cktqr',
    title: '出库提取人',
    sortable:true
  }, {
    field: 'sqbmmc',
    title: '申请部门',
    sortable:true
  }, {
    field: 'sqrmc',
    title: '申请人',
    sortable:true
  }];

//生成图片列表
function creatImgList(data){
	var tHtml = "";
	if(data != null){
		$.each(data,function(index,value){
			tHtml += "<div>";
			tHtml += "<a href='collectionDetail.html'><img src='../../resources/images/"+value["daiBiaoYingXiang"]+"'></a>";
			tHtml += "<p><a href='collectionDetail.html'>"+value["mingCheng"]+"</a></p>";
			tHtml += "</div>";
		});
	}
	$(".imglist").html(tHtml);
}